package com.inspector.app.util;

import android.text.TextUtils;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Locale;

public class StringUtils {
    public StringUtils() {
    }

    public static boolean isEmpty(String str) {
        int strLen;
        if (str != null && (strLen = str.length()) != 0 && !str.equalsIgnoreCase("null")) {
            for(int i = 0; i < strLen; ++i) {
                if (!Character.isWhitespace(str.charAt(i))) {
                    return false;
                }
            }

            return true;
        } else {
            return true;
        }
    }

    public static boolean equals(CharSequence a, CharSequence b) {
        return TextUtils.equals(a, b);
    }

    public static boolean isNumeric(String str) {
        int i = str.length();

        do {
            --i;
            if (i < 0) {
                return true;
            }
        } while(Character.isDigit(str.charAt(i)));

        return false;
    }

    public static String encodeString(String str) {
        try {
            return URLEncoder.encode(str, "UTF-8");
        } catch (UnsupportedEncodingException var2) {
            var2.printStackTrace();
            return str;
        }
    }

    public static String decodeString(String str) {
        try {
            return URLDecoder.decode(str, "UTF-8");
        } catch (UnsupportedEncodingException var2) {
            var2.printStackTrace();
            return str;
        }
    }

    public static String toLowerCase(String s) {
        return s.toLowerCase(Locale.getDefault());
    }

    public static String toUpperCase(String s) {
        return s.toUpperCase(Locale.getDefault());
    }
}
